﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="../lib/jquery.showloading/css/jquery.showloading.css" />
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.min.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.1/layer.js"></script> 
<script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="../lib/jquery.showloading/jquery.showloading.js"></script> 
<script type="text/javascript" src="../lib/jquery.pagination/jquery.pagination.js"></script> 
<script type="text/javascript" src="../static/eth/js/pagination.js"></script>
<title>国际机票</title>
</head>
<body id="body">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 运价搜索 <span class="c-gray en">&gt;</span> 国际机票_1 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c"> 
	    <form id="form" action="search-split-web" method="get">
	    <div class="formControls col-xs-8 col-sm-2">
		    <span class="select-box inline">
			    <select name="flightType" class="select">
			        <#if req.flightType == "OW">
			            <option value="OW" selected>单程</option>
			             <#else><option value="OW">单程</option>
			        </#if>
			        <#if req.flightType == "RT">
			            <option value="RT" selected>往返</option>
			             <#else><option value="RT">往返</option>
			        </#if>
				</select>
			</span>
		</div>
		<div class="formControls col-xs-8 col-sm-2">
		    <input type="text" name="departure" value="${req.departure!''}" placeholder=" 出发地" class="input-text">
		</div>
		<div class="formControls col-xs-8 col-sm-2">
		    <input type="text" name="arrival" value="${req.arrival!''}" placeholder=" 到达地" class="input-text">
		</div>
		
		<div class="formControls col-xs-8 col-sm-2">
		    <input type="text" name="departureDate" value="${req.departureDate!''}" onfocus="WdatePicker({minDate:'%y-%M-%d'})" id="logmin" class="input-text Wdate" placeholder=" 出发日期">
		</div>
		<div class="formControls col-xs-8 col-sm-2">
		    <input type="text" name="returnDate" value="${req.returnDate!''}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'logmin\')||\'%y-%M-%d\'}'})" id="logmax" class="input-text Wdate" placeholder=" 返回日期">
		</div>
		<input type="hidden" name="fareKey" id="fareKey" value="${fareKey}">
		<button name="" class="btn btn-success" type="submit" onclick="jQuery('#body').showLoading();$('#fareKey').val('');"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
		</form>
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th>行程信息</th>
					<th width="120">运价信息</th>
					<th width="80">匹配政策</th>
					<th width="120">操作</th>
				</tr>
			</thead>
			<tbody>
			    <#list fares! as fare>
			    <tr class="text-c">
					<td class="text-l">
					    <#list fare.flights as flight>
					        <#list flight.segments as segment>
					            <span>${segment.departureName}(${segment.teminalDep!''})-${segment.arrivalName}(${segment.teminalArr!''}): ${segment.airline}${segment.flightNo}(${segment.bookingCode!''}) ${segment.departureDate}/${segment.departureTime}-${segment.arrivalDate}/${segment.arrivalTime}</span><br/>
					        </#list>
					    </#list>
					</td>
					<td>
					    <span>票价：${fare.searchTicketPrice!''}</span><br/>
					    <span>税费：${fare.tax}</span><br/>
					    <span>含税总价：${fare.totalPrice}</span>
					</td>
					<td>${fare.policyId!''}</td>
					<td class="f-14 td-manage">
					    <#if req.flightType == "RT" && fareKey=="">
					        <a style="text-decoration:none" onclick="jQuery('#body').showLoading();$('#fareKey').val('${fare.fareKey}');$('form').submit();" title="选定去程">选定去程</a>
					        <#else>
					        <a style="text-decoration:none" onclick="jQuery('#body').showLoading();$('#fareKey').val('${fare.fareKey}');pricing();" title="验价">验价</a>
					    </#if>
					</td>
				</tr>
			    </#list>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
function pricing(){
	jQuery.ajax({  
        type : 'GET',  
        contentType : 'application/json', 
        url : "pricing-json?fareKey=" + $('#fareKey').val(),
        success : function(data) {
      	  var rsult = jQuery.parseJSON(data);
      	  if (rsult.success) {
      		layer.msg(rsult.message + "，含税总价:" + rsult.obj.totalPrice, {icon:6,time:3000});
      	  } else 
      		layer.msg("验价失败!原因:" + rsult.message, {icon:5,time:3000});
      	  $('#body').hideLoading();
        },  
        error : function(data) {  
        	layer.msg('验价失败！', {icon:5,time:3000});
        	$('#body').hideLoading();
        }  
    });
}
$(function(){
	$("#form").validate({
		rules:{
			departure:{
				required:true,
			},
			arrival:{
				required:true,
			},
			departureDate:{
				required:true,
			},
			returnDate:{
				required:true,
			},
		},
		onkeyup:true,
		focusCleanup:false,
		success:"valid",
		/* invalidHandler: function(form, validator) {return false;},
		submitHandler: function(form) {
			jQuery('#body').showLoading();
			return;
		} */
	});
});
</script>
</body>
</html>